package com.ruoyi.oss.enumd;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.oss.service.impl.MinioOssStrategy;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 吴倩芸
 * @create 2022/6/13
 **/
@Getter
@AllArgsConstructor
public enum  OssEnumd {

    /**
     * minio
     */
    MINIO("minio", MinioOssStrategy.class);

    private final String value;

    private final Class<?> serviceClass;

    public static Class<?> getServiceClass(String value) {
        for (OssEnumd clazz : values()) {
            if (clazz.getValue().equals(value)) {
                return clazz.getServiceClass();
            }
        }
        return null;
    }

    public static String getServiceName(String value) {
        for (OssEnumd clazz : values()) {
            if (clazz.getValue().equals(value)) {
                return StringUtils.uncapitalize(clazz.getServiceClass().getSimpleName());
            }
        }
        return null;
    }



}
